package com.zzyl.nursing.controller.member;

import com.zzyl.common.core.controller.BaseController;
import com.zzyl.common.core.domain.AjaxResult;
import com.zzyl.common.core.page.TableDataInfo;
import com.zzyl.nursing.dto.DeviceDto;
import com.zzyl.nursing.dto.UserLoginRequestDto;
import com.zzyl.nursing.dto.member.DevicePropertyQueryDto;
import com.zzyl.nursing.dto.member.FamilyAddDto;
import com.zzyl.nursing.service.IFamilyMemberService;
import com.zzyl.nursing.vo.LoginVo;
import com.zzyl.nursing.vo.member.FamilyMyVo;
import com.zzyl.nursing.vo.member.QueryDeviceDataListByDayVo;
import com.zzyl.nursing.vo.member.ResponseDataVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 老人家属Controller
 * 
 * @author ruoyi
 * @date 2024-09-19
 */
@RestController
@RequestMapping("/member/user")
@Api(tags = "老人家属的接口")
public class FamilyMemberController extends BaseController
{
    @Autowired
    private IFamilyMemberService familyMemberService;


    @PostMapping("/login")
    @ApiOperation("小程序登录")
    public AjaxResult login(@RequestBody UserLoginRequestDto dto){
        LoginVo loginVo = familyMemberService.login(dto);
        return success(loginVo);
    }

    @GetMapping("/my")
    public AjaxResult selectMy() {

        return success(familyMemberService.selectMy());
    }

    @PostMapping("/add")
    public AjaxResult addPerson(@RequestBody FamilyAddDto familyAddDto){
        familyMemberService.addPerson(familyAddDto);
        return success();
    }

    @GetMapping("/list-by-page")
    public TableDataInfo queryPage(){
        startPage();
        return getDataTable(familyMemberService.queryPage());
    }

    @PostMapping("/QueryDevicePropertyStatus")
    public AjaxResult getHealthData(@RequestBody DeviceDto dto){
        ResponseDataVo list=familyMemberService.getHealthData(dto);
        return success(list);
    }

    @GetMapping("/queryDeviceDataListByDay")
    public AjaxResult showDeviceDataListByDay(DevicePropertyQueryDto dto){
        List<QueryDeviceDataListByDayVo> list = familyMemberService.showDeviceDataListByDay(dto);
        return success(list);
    }

    @GetMapping("/queryDeviceDataListByWeek")
    public AjaxResult showDeviceDataListByWeek(DevicePropertyQueryDto dto){
        List<QueryDeviceDataListByDayVo> list = familyMemberService.showDeviceDataListByWeek(dto);
        return success(list);
    }




}
